﻿<Window x:Class="WMSSoft.WinKStart.Setting_AddActionTrigger"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Name="SettingAddActionTrigger" 
        Title="{Binding ViewName}" Height="232" Width="455" ResizeMode="NoResize" ShowInTaskbar="False" WindowStartupLocation="CenterOwner"  WindowStyle="ToolWindow">
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
                <Label Content="Event" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top"/>
            <ComboBox Grid.Column="1" Grid.Row="0" SelectedValue="{Binding SelectedEvent}" ItemsSource="{Binding EventSourceItems}" DisplayMemberPath="Value" SelectedValuePath="Key"/>
            <Label Content="Condition" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.Row="1"/>
            <Grid Margin="0,10,0,0" Grid.Column="1" Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition  Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.Resources>
                    <ImageBrush x:Key="AddButtonImageBrush" ImageSource="/WinKStart;component/images/list-add.png" Stretch="Fill"/>
                    <ImageBrush x:Key="EditButtonImageBrush" ImageSource="/WinKStart;component/images/list-edit.png" Stretch="Fill"/>
                    <ImageBrush x:Key="DeleteButtonImageBrush" ImageSource="/WinKStart;component/images/list-remove.png" Stretch="Fill"/>
                </Grid.Resources>
                <ListView x:Name="lst_ConditionItems" Height="100" SelectedItem="{Binding SelectedCondition}" ItemsSource="{Binding ConditionItems}">
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="Element" DisplayMemberBinding="{Binding Element}" Width="100"/>
                            <GridViewColumn Header="Property" DisplayMemberBinding="{Binding Property}" Width="150" />
                            <GridViewColumn Header="Operator" DisplayMemberBinding="{Binding Operator}" Width="70" />
                            <GridViewColumn Header="Value" DisplayMemberBinding="{Binding ConditionValue}" Width="70" />
                        </GridView>
                    </ListView.View>
                </ListView>
                <StackPanel Grid.Column="1">
                    <Button Content="" Margin="5,0,0,10" Height="20" Background="{StaticResource AddButtonImageBrush}" Command="{Binding Cmd_AddCondition.Command}" CommandParameter="{Binding ElementName=lst_ConditionItems}" RenderTransformOrigin="2,0"/>
                    <Button Content="" Margin="5,0,0,10" Width="20"  Background="{StaticResource EditButtonImageBrush}" Command="{Binding Cmd_EditCondition.Command}" CommandParameter="{Binding ElementName=lst_ConditionItems}" IsEnabled="{Binding CanEditDeleteSourceElement}"/>
                    <Button Content="" Margin="5,0,0,10" Width="20"  Background="{StaticResource DeleteButtonImageBrush}" Command="{Binding Cmd_DeleteCondition.Command}" CommandParameter="{Binding ElementName=lst_ConditionItems}" IsEnabled="{Binding CanEditDeleteSourceElement}"/>
                </StackPanel>
            </Grid>
          </Grid>  
            <Grid Margin="0,10,0,0" Grid.Row="3">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
            <Button Content="{Binding Cmd_Ok.ViewName}" Grid.Column="0" Height="23" HorizontalAlignment="Right" Margin="0,0,5,0" Width="100" IsDefault="True" Command="{Binding Cmd_Ok.Command}"  CommandParameter="{Binding ElementName=SettingAddActionTrigger}"/>
            <Button Content="{Binding Cmd_Close.ViewName}" Grid.Column="1" Height="23" HorizontalAlignment="Left" Margin="5,0,0,0" Width="100" IsCancel="True" Command="{Binding Cmd_Close.Command}"  CommandParameter="{Binding ElementName=SettingAddActionTrigger}"/>
            </Grid>
        
    </Grid>
</Window>
